﻿#if !defined (_MESH_CLASS)
#define _MESH_CLASS

#include "supportClass.h"

class VertexID
{
public:
	int vertIndex;
	int colorIndex;
};

class Face
{
public:
	int nVerts;
	VertexID* vert;

	Face(){
		nVerts = 0;
		vert = NULL;
	}
	~Face(){
		if (vert != NULL){
			delete[] vert;
			vert = NULL;
		}
		nVerts = 0;
	}
};

class Mesh
{
public:
	int numVerts;
	Point3* pt;

	int	numFaces;
	Face* face;
	float slideX, slideY, slideZ; //toạ độ điểm đặt của vật thể

	Mesh()
	{
		numVerts = 0;
		pt = NULL;
		numFaces = 0;
		face = NULL;
		slideX = slideY = slideZ = 0;
	}
	~Mesh()
	{
		if (pt != NULL)
		{
			delete[] pt;
		}
		if (face != NULL)
		{
			delete[] face;
		}
		numVerts = 0;
		numFaces = 0;
	}

	void DrawWireframe();
	void DrawColor();
	void SetColor(int colorIdx);
	void CreateXZPlane(int row, int col, float size);
	void CreateSphere(int nSlices, int nStacks, GLdouble fRadius);
	void CreateCube(float fSize);
	void CreateTruncatedCube(float fSize);
	void CreateDodecahedron(float fSize);
	void CreateIcosahedron(float fSize);
	void CreateCylinder(int nSegments, float fHeight, float fRadius);
	void CreateCuboid(float fSizeX, float fSizeY, float fSizeZ);
	void CreateUShape(float fSizeX, float fSizeY, float fSizeZ, float fThick);
};
#endif